<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h3 class="text-center">用户注册</h3>
                </div>
                <div class="card-body">
                    <form th:action="@{/api/auth/register}" method="post" th:object="${registerRequest}">
                        <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>

                        <div class="mb-3">
                            <label for="username" class="form-label">用户名</label>
                            <input type="text" class="form-control" id="username"
                                   th:field="*{username}" required>
                        </div>

                        <div class="mb-3">
                            <label for="email" class="form-label">邮箱</label>
                            <input type="email" class="form-control" id="email"
                                   th:field="*{email}" required>
                        </div>

                        <div class="mb-3">
                            <label for="password" class="form-label">密码</label>
                            <input type="password" class="form-control" id="password"
                                   th:field="*{password}" required>
                        </div>

                        <div class="mb-3">
                            <label for="confirmPassword" class="form-label">确认密码</label>
                            <input type="password" class="form-control" id="confirmPassword"
                                   th:field="*{confirmPassword}" required>
                        </div>

                        <button type="submit" class="btn btn-primary w-100">注册</button>
                    </form>

                    <div class="mt-3 text-center">
                        <a th:href="@{/api/auth/login}">已有账号？立即登录</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>